package com.xhh.nphm.system.mapper;

import com.xhh.nphm.system.domain.SensitiveInfoDetail;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.xhh.nphm.system.domain.SensitiveInfoField;
import org.apache.ibatis.annotations.*;

import java.util.List;

/**
* @author Administrator
* @description 针对表【tm_sensitive_info_detail(敏感信息详情表)】的数据库操作Mapper
* @createDate 2022-07-11 16:42:59
* @Entity com.xhh.nphm.system.domain.SensitiveInfoDetail
*/
@Mapper
public interface SensitiveInfoDetailDao extends BaseMapper<SensitiveInfoDetail> {
    /**
     * 通过敏感信息id查询所有详情信息
     * @param sid 敏感信息id
     */
    @Results(id = "sensitive_detail",value = {
            @Result(column = "id",property = "id"),
            @Result(column = "fieldId",property = "fieldId"),
            @Result(column = "value",property = "value"),
            @Result(column = "isDel",property = "isDel"),
            @Result(column = "sensitiveId",property = "sensitiveId"),
            @Result(column = "fieldId",property = "field",javaType = SensitiveInfoField.class,one = @One(select = "com.xhh.nphm.system.mapper.SensitiveInfoFieldDao.selectById")),
    })
    @Select("SELECT id,fieldId,[value],isDel,sensitiveId FROM tm_sensitive_info_detail WHERE isDel = 0 AND sensitiveId = #{sid};")
    List<SensitiveInfoDetail> findDetailsBySensitiveId(@Param("sid")Integer sid);

}




